package com.smdd.project.controller;

import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
import com.smdd.project.entity.CardInfo;
import com.smdd.project.entity.R;
import com.smdd.project.feign.UserManagementClient;
import com.smdd.project.service.TradeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * @ClassName HelloWorldController
 * @Description TODO
 * @Author wyp
 * @Date 2023/7/7 16:41
 * @Version 1.0
 */
@Api(tags = "交易管理API", description = "提供交易相关操作的接口")
@RestController
@RequestMapping("/trade")
public class HelloWorldController {

    @Autowired
    private TradeService tradeService;

    @Autowired
    private UserManagementClient userManagementClient;

    @ApiOperation("测试接口")
    @GetMapping("findById")
    public R getTradingInfo(@RequestParam("id") String id) {
        CardInfo cardInfo = tradeService.findByCardInfo(id);
        R r = userManagementClient.getUser("22");
        HashMap<String, Object> resultMap = new HashMap<>();
        resultMap.put("cardInfo", cardInfo);
        resultMap.put("userInfo", r.get("data"));
        return R.ok().put("data", resultMap);
    }
}
